********** OVERVIEW **********;
*DES 8/7/17;
*reads in shape files, see: cordinate conversion instructions.docx;
/*
Files needed to run: 
1. Stcoords_lat.dta -- Interstates in lat and long cordinates.  

Using the newly created file with latitude and longitude coordinates attached
to the road objects, this file:

1. Merges the coordinate file onto the road file
2. Saves this as a new file
*/
*******************************************************************************/

clear 
set more off
capture log close
#delimit;

* Change directory locations and add more if necessary;

global home ;
global rawdata ;
global samples ;


log using "$home\make_interstates.log", text replace;


*Firt setup LAC_raods_Latlong, which is going to be the merged LACroads.dta with LACroads_lat_coords;

import delimited "$rawdata\strdcoords_lat.csv";


rename _id _ID;

rename x longitude;
rename y latitude; 

sort _ID;

merge m:1 _ID using "$rawdata\interstates.dta";

drop _merge;

save "$rawdata\intstate_analysis.dta", replace;










